import request from '@/utils/request'

// 获取权限列表
export function getPermission(params) {
  return request({
    url: '/permissions',
    method: 'get',
    params
  })
}

// 获取权限数量
export function getPermissionPage() {
  return request({
    url: '/permissions/count',
    method: 'get'

  })
}

// 新建权限
export function addPermission(data) {
  return request({
    url: '/permissions',
    method: 'post',
    data
  })
}

// 删除权限
export function delPermission(id) {
  return request({
    url: `/permissions/${id}`,
    method: 'delete'
  })
}

// 获取指定权限
export function getPermissionId(id) {
  return request({
    url: `/permissions/${id}`,
    method: 'get'
  })
}

// 编辑权限
export function editPermission(data) {
  return request({
    url: `/permissions/${data.id}`,
    method: 'put',
    data
  })
}
